package com.ruoyi.system.generatorTask;

/**
 * @className: PasswordGenerator
 * @Description: TODO
 * @version: v1.８.0
 * @author: 王家敏
 * @date: 2025/10/20 22:18
 */

import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;

/**
 * 密碼加密工具類
 */
public class PasswordGenerator {
    public static void main(String[] args) {
        BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
        String rawPassword = "admin";//原始密碼
        String encodedPassword = passwordEncoder.encode(rawPassword);
        System.out.println("加密後的密碼：" + encodedPassword);

        //驗證密碼是否正確
        boolean matches = passwordEncoder.matches(rawPassword, encodedPassword);
        System.out.println("密碼匹配：" + matches);
    }
}
